#ifndef COMMUNICATION_H
#define COMMUNICATION_H

#include <QThread>
#include <QString>
#include <QMutex>
#include "picture.h"


typedef enum {
    GPIC = 0,
    SAEC
}   Cmd_Typedef;


class Communication : public QThread
{
    Q_OBJECT

public:
    explicit Communication(QObject * parent = 0);
    bool SerialPortInit(QString com);
    void SerialPortClose();
    void GetPic( AL_BYTE *data);
    void GetPic( Picture *pic);
    void SetCenter( AL_WORD x,AL_WORD y);

protected:
    void run();

signals:
    void gotPic();
    void gotRegisterPic();

public slots:
    void signalSendSet(bool ifSend);
    void releaseData();
    void SetAec(int picCount, int *aec);

private:
    AL_WORD cx;
    AL_WORD cy;
    bool signalSend;
    static QMutex dataNew;

    Cmd_Typedef cmd;

    int picCount;
    AL_WORD aecs[8];


};

#endif // COMMUNICATION_H
